
from scapy.all import Ether, IP, sendp, Packet
from scapy.fields import ByteField, ShortField, StrField, IntField

def send_packet():
    # 创建一个以太网帧
    ether = Ether(src="6c:b3:11:83:00:ef", dst='6c:b3:11:83:00:ee')  # 在这里指定目标 MAC 地址
    # 创建一个 IP 数据包
    ip = IP(dst="172.22.10.10", src="172.22.10.11", proto=17) / "Hello, Receiver!"
    # 将以太网帧和 IP 数据包组合
    packet = ether / ip
    # 发送数据包
    sendp(packet, iface="enp5s0f1np1", verbose=True)

if __name__ == "__main__":
    send_packet()